<?php
    $this->headTitle('Chi tiết tin rao vặt','append');
    switch(strlen($this->userCheck['mobile'])) {        
    case 10:
        $this->userCheck['mobile'] = preg_replace("/([0-9]{3})([0-9]{3})([0-9]{4})/", "$1 $2 $3", $this->userCheck['mobile']);
        break;
    case 11:
        $this->userCheck['mobile'] = preg_replace("/([0-9]{4})([0-9]{4})([0-9]{3})/", "$1 $2 $3", $this->userCheck['mobile']);
        break;
    default:        
        break;
    }
?>
<div class="dashboard-menu dashboard-admin">
    <span class="back">&nbsp;</span>
    <a href="<?=$this->url(array('module'=>'admin', 'controller'=>'product', 'action'=>'detail', 'id'=>$this->proCheck['id']))?>"><h1>Chi tiết tin rao vặt</h1></a>    
</div>

<div class="row">
    <div class="col-md-12">
        <div class="widget-big product-detail">            
            <h2 class="jumbotron text-center"><?=$this->proCheck['title']?></h2>                        
            <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
                <!-- Indicators -->
                <ol class="carousel-indicators">
                    <?php                         
                        $image = json_decode($this->proCheck['photo']);
                        $i=0;
                        foreach($image as $ime){
                            if($i==0){
                                echo '<li data-target="#carousel-example-generic" data-slide-to="'.$i.'" class="active"></li>';
                            }else{
                                echo '<li data-target="#carousel-example-generic" data-slide-to="'.$i.'"></li>';
                            }   
                            $i++;                                                     
                        }
                        $configTran= new Zend_Config_Ini(CONFIG_PATH.'/transaction.ini', APPLICATION_ENV);
                        $tranL=$configTran->transaction->toArray();
                        $configHu= new Zend_Config_Ini(CONFIG_PATH.'/human.ini', APPLICATION_ENV);
                        $tranH=$configHu->human->toArray();
                        $this->proCheck['transaction'] = $tranL[$this->proCheck['transaction']];                         
                        $this->proCheck['human'] = $tranH[$this->proCheck['human']];                        
                    ?>                    
                </ol>        
                <!-- Wrapper for slides -->
                <div class="carousel-inner" role="listbox">
                <?php
                    $i=0;
                    foreach($image as $ime){
                       if($i==0){
                ?>
                    <div class="item active">
                        <img src="upload/product/<?=$ime?>" alt=""/>
                        <div class="carousel-caption"></div>
                    </div>
                <?php
                       }else{
                ?>
                    <div class="item">
                        <img src="upload/product/<?=$ime?>" alt=""/>
                        <div class="carousel-caption">                        
                        </div>
                    </div>
                <?php
                       }
                       $i++; 
                    }
                ?>                                                     
                </div>        
                <!-- Controls -->
                <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
                    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                    <span class="sr-only">Previous</span>
                </a>
                <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
                    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                    <span class="sr-only">Next</span>
                </a>
            </div>
            <hr />       
            <div class="row" style="margin-bottom:30px;">                            
                <div class="col-md-3">
                    <h4>Chi tiết sản phẩm</h4>
                    <div class="info-group">
                        <label class="group-label">Khu vực: </label>                        
                    </div>
                    <div class="info-group text-right">                        
                        <span class="group-element"><?=$this->proCheck['areaName']?></span>
                    </div>                    
                    <div class="info-group">
                        <label class="group-label">Danh mục: </label>                        
                    </div>
                    <div class="info-group text-right">                        
                        <span class="group-element"><?=$this->proCheck['catName']?> &gt;&gt; <?=$this->proCheck['itemName']?></span>
                    </div>
                    <div class="info-group">
                        <label class="group-label">Giao dịch: </label>                        
                    </div>
                    <div class="info-group text-right">                        
                        <span class="group-element"><?=$this->proCheck['transaction']?></span>
                    </div>
                    <div class="info-group">
                        <label class="group-label">Đối tượng: </label>                        
                    </div>
                    <div class="info-group text-right">                        
                        <span class="group-element"><?=$this->proCheck['human']?></span>
                    </div>                                        
                </div>    
                <div class="col-md-6">
                    <h4>Mô tả sản phẩm</h4>                
                    <div class="info-group">                        
                        <span class="group-element"><?=$this->proCheck['content']?></span>
                    </div>
                    <h4>Giá sản phẩm</h4>
                    <div class="info-group">                        
                        <span class="group-element"><?=number_format($this->proCheck['price'],0,'.',',')?> VNĐ</span>
                    </div>
                    
                </div>
                <div class="col-md-3">
                    <h4>Thông tin liên hệ</h4>
                    <div class="info-group">
                        <label class="group-label">Người liên hệ: </label>                        
                    </div>
                    <div class="info-group text-right">                        
                        <span class="group-element"><?=$this->proCheck['contact']?>&nbsp;</span>
                    </div>
                    <div class="info-group">
                        <label class="group-label">Số di động: </label>                        
                    </div>
                    <div class="info-group text-right">                        
                        <span class="group-element"><?=$this->proCheck['mobile']?>&nbsp;</span>
                    </div>
                    <div class="info-group">
                        <label class="group-label">Email: </label>                        
                    </div>
                    <div class="info-group text-right">                        
                        <span class="group-element"><?=$this->proCheck['emailCont']?>&nbsp;</span>
                    </div>
                    <div class="info-group">
                        <label class="group-label">Địa chỉ liên hệ: </label>                        
                    </div>
                    <div class="info-group text-right">                        
                        <span class="group-element"><?=$this->proCheck['addressCont']?>&nbsp;</span>
                    </div>
                </div>
            </div>
            <hr />
            <div class="row" style="margin-bottom: 30px;">
                <center><h4>Chi tiết tin rao vặt</h4></center>                            
                <div class="col-md-4">            
                    <div class="info-group">
                        <label class="group-label">Ngày tạo: </label>
                        <span class="group-element"><?=$this->proCheck['createDate']?></span>
                    </div>
                    <div class="info-group">
                        <label class="group-label">Loại tin: </label>
                        <span class="group-element"><?= ($this->proCheck['type']=='no')? 'Tin Thường':'Tin Vip'?></span>
                    </div>                    
                </div>
                <div class="col-md-4">
                    <div class="info-group">
                        <label class="group-label">Ngày đăng: </label>
                        <span class="group-element"><?=$this->proCheck['startDate']?></span>
                    </div>
                    <div class="info-group">
                        <label class="group-label">Tài khoản sở hữu: </label>
                        <span class="group-element"><?=$this->proCheck['email']?></span>
                    </div>
                </div>                
                <div class="col-md-4">
                    <div class="info-group">
                        <label class="group-label">Ngày kết thúc: </label>
                        <span class="group-element"><?=$this->proCheck['endDate']?></span>
                    </div>
                    <div class="info-group">
                        <label class="group-label">Phí đăng tin: </label>
                        <span class="group-element"><?=number_format($this->proCheck['priceAd'],0,'.',',')?> VNĐ</span>
                    </div>
                </div>
            </div>  
            <hr />
            <div class="row" style="margin-bottom: 30px;">
                <center><h4>Thông tin tài khoản</h4></center>                            
                <div class="col-md-4">            
                    <div class="info-group">
                        <label class="group-label">Tên chủ tài khoản: </label>
                        <span class="group-element"><?php echo $this->userCheck['fullname']?></span>
                    </div>
                    <div class="info-group">
                        <label class="group-label">Email: </label>
                        <span class="group-element"><?php echo $this->userCheck['email'] ?></span>
                    </div>                    
                </div>
                <div class="col-md-4">
                    <div class="info-group">
                        <label class="group-label">Di động: </label>
                        <span class="group-element"><?php echo $this->userCheck['mobile']?></span>
                    </div>
                    <div class="info-group">
                        <label class="group-label">Số dư: </label>
                        <span class="group-element"><?php echo number_format($this->userCheck['gold'],0,'.',',') ?> VNĐ</span>
                    </div>
                </div>                
                <div class="col-md-4">
                    <div class="info-group">
                        <label class="group-label">Địa chỉ: </label>
                        <span class="group-element"><?php echo $this->userCheck['address']?></span>
                    </div>
                    <div class="info-group">
                        <label class="group-label">Số bài đăng: </label>
                        <span class="group-element"><?php echo $this->userCheck['qty']?></span>
                    </div>
                </div>
            </div>                                                                                            
        </div>
    </div>
</div>